<template>
    <Button type="text" size="small" @click="handleAppDelete(data)">删除</Button>
</template>

<script>
export default {
    name: "AppDeleteButton",
    props: {
        data: Object
    },
    methods: {
        handleAppDelete(row) {
            this.$Modal.confirm({
                title: '删除',
                content: '确定删除吗？',
                onOk: () => {
                    this.$http.post('/delete_app', {app_id: row.app_id}).then(res => {
                        if (res.status == 'ok') {
                            this.$Message.success('删除成功');
                            this.$emit('success')
                        } else {
                            this.errorMessage(res.data);
                        }
                    });
                },
                onCancel: () => {
                    this.$Message.info('取消删除');
                }
            });
        },
    }
}
</script>